﻿<p style="margin-left: 40px">
    \<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Contra_view.aspx.cs" Culture="en-GB"
    Inherits="Main_Accounts_VoucherDisplay_Contra_view" %>

<%@ Register Src="~/User Controls/PageHeading.ascx" TagName="heading" TagPrefix="acc" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<%@ Register Assembly="CalendarExtenderPlus" Namespace="AjaxControlToolkitPlus" TagPrefix="advancedCalender" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Contra View</title>
    <link href="../../../Styles/accounts.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        function checkDate() {
            var fromDate = document.getElementById("txtfrom");
            var toDate = document.getElementById("txtto");

            var arrFrom = fromDate.value.split("/");
            var fromDate1 = arrFrom[1] + '/' + arrFrom[0] + '/' + arrFrom[2];
            var arrTo = toDate.value.split("/");
            var toDate1 = arrTo[1] + '/' + arrTo[0] + '/' + arrTo[2];

            var mainFromDate = new Date(fromDate1);
            var mainToDate = new Date(toDate1);
            if (mainFromDate > mainToDate) {
                alert('Start Date Should Be Less Than');
                return false;
            }
            else {
                return true;
            }
        }
        function go(key, from, to, transactiontype) {
            window.open('../VoucherPrint/Voucher_Print.aspx?key=' + key + '&from=' + from + '&to=' + to + '&transactiontype=' + transactiontype, 'Voucher', 'width=700, height=600, resizable=0');
        }
        function EnabledTabKey(id, e) {
            var keycode;
            if (window.event) {
                keycode = window.event.keyCode;
            }
            else if (e) {
                keycode = e.which;
            }
            else {
                return true;
            }

            if (keycode == 9) {
                // if is the tab key                
                return true;
            }
            else {
                return false;
            }
        }
    </script></head><body></p>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <acc:heading ID="pagehead" runat="server" HeadingText="Contra Detail's" />
    <div style="width: 90%; margin-left: 5%; margin-right: 5%;">
        <%--  <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>--%>
        <div style="margin-left: 5%; padding-bottom: 3px; padding-top: 2px; margin-right: 5%;
            width: 90%" align="center">
            <asp:Label ID="lblMsg" EnableViewState="false" runat="server" Font-Bold="true"></asp:Label>
        </div>
        <div style="width: 98%">
            <div style="width: 100%;">
                <table style="margin-right: 7px;">
                    <tr>
                        <td align="right" style="vertical-align: middle; width: 7%;">
                            <b>From:</b>
                        </td>
                        <td style="width: 12%;">
                            <asp:TextBox ID="txtfrom" Width="70px" runat="server" onkeydown="return EnabledTabKey(this.id, event);"
                                CssClass="input" ValidationGroup="contra" />
                            <asp:ImageButton ID="imgfrmdate" runat="server" ImageUrl="~/Images/calendar.gif" />
                            <advancedcalender:calendarextenderplus id="CalFrom" runat="server" popupbuttonid="imgfrmdate"
                                format="dd/MM/yyyy" targetcontrolid="txtfrom">
                            </advancedcalender:calendarextenderplus>
                            <asp:RequiredFieldValidator ID="reqFromDate" runat="server" ControlToValidate="txtfrom"
                                ErrorMessage="*" ValidationGroup="contra"></asp:RequiredFieldValidator>
                            <%--<ajaxToolkit:CalendarExtender ID="claFromDate" runat="server"  TargetControlID ="txtfrom" PopupButtonID="imgfrmdate" Format="dd/MM/yyyy" Enabled="True" ></ajaxToolkit:CalendarExtender> 
                        <ajaxToolkit:MaskedEditExtender ID="maskFromDate" runat="server"  CultureName="en-GB"  TargetControlID="txtfrom"
                            Mask="99/99/9999" MaskType="Date"></ajaxToolkit:MaskedEditExtender>
                        <ajaxToolkit:MaskedEditValidator ID="valFromDate" runat="server" ControlExtender="maskFromDate"
                            ControlToValidate="txtfrom" InvalidValueMessage="Invalid Date" TooltipMessage="Invalid Date"></ajaxToolkit:MaskedEditValidator>
                        --%>
                        </td>
                        <td align="right" style="vertical-align: middle; width: 5%;">
                            <b>To:</b>
                        </td>
                        <td style="width: 12%;">
                            <asp:TextBox ID="txtto" Width="70px" runat="server" onkeydown="return EnabledTabKey(this.id, event);"
                                CssClass="input" ValidationGroup="contra" />
                            <asp:ImageButton ID="Imageto" runat="server" ImageUrl="~/Images/calendar.gif" />
                            <advancedcalender:calendarextenderplus id="CalendarExtenderPlus1" runat="server"
                                popupbuttonid="Imageto" format="dd/MM/yyyy" targetcontrolid="txtto">
                            </advancedcalender:calendarextenderplus>
                            <asp:RequiredFieldValidator ID="reqToDate" runat="server" ControlToValidate="txtto"
                                ErrorMessage="*" ValidationGroup="contra"></asp:RequiredFieldValidator>
                            <%--<ajaxToolkit:CalendarExtender ID="calToDate" runat="server"  TargetControlID ="txtto"  PopupButtonID="Imageto" Format="dd/MM/yyyy" Enabled="True" ></ajaxToolkit:CalendarExtender>
                    <ajaxToolkit:MaskedEditExtender ID="maskToDate" CultureName="en-GB" runat="server" TargetControlID="txtto"
                        Mask="99/99/9999" MaskType="Date"></ajaxToolkit:MaskedEditExtender>
                    <ajaxToolkit:MaskedEditValidator ID="valToDate" runat="server"  ControlExtender="maskToDate"
                        ControlToValidate="txtto" InvalidValueMessage="Invalid Date" TooltipMessage="Invalid Date"></ajaxToolkit:MaskedEditValidator>--%>
                        </td>
                        <td style="vertical-align: top; width: 11%;">
                            <asp:Button ID="btnSearch_period" runat="server" Text="View" CssClass="button" OnClientClick="return checkDate();"
                                OnClick="btnSearch_period_Click" ValidationGroup="contra" />
                        </td>
                        <td style="width: 9%;">
                            <b>Transaction</b>
                        </td>
                        <td style="width: 12%;">
                            <asp:DropDownList ID="ddlTransaction" runat="server" CssClass="dropdown" AutoPostBack="true" OnSelectedIndexChanged="ddlTransaction_SelectedIndexChanged" Width="98%">
                            </asp:DropDownList>
                        </td>
                        <td align="right" style="width:10%;">
                            <b>Voucher No.</b>
                        </td>
                        <td align="center" style="width:10%;">
                            <asp:TextBox ID="TxtvoucherNo" Width="70px" runat="server" CssClass="input"></asp:TextBox>
                        </td>
                        <td style="width:10%;">
                            <asp:Button ID="BtnSearch" runat="server" CssClass="button" Text="search" OnClick="BtnSearch_Click" />
                        </td>
                    </tr>
                </table>
            </div>
            <div style="clear: both">
                &nbsp;
            </div>
        </div>
        <div align="left" style="margin-left: 5px; font-family: Verdana; color: #9b9b9b;
            font-size: 11px">
            <b>
                <asp:Label ID="lblRecord" EnableViewState="false" runat="server"></asp:Label>
            </b>
        </div>
        <div style="width: 100%; height: 10px">
            &nbsp;</div>
        <asp:Panel ID="pnlcontra" runat="server" Visible="true">
            <asp:DataList ID="dtlcontra" runat="server" Width="95%" CellPadding="5" CellSpacing="0"
                OnItemDataBound="dtlcontra_ItemDataBound" OnItemCommand="dtlcontra_ItemCommand">
                <ItemTemplate>
                    <table width="100%" cellspacing="0" cellpadding="0" style="border-bottom: solid 1px #818181;
                        border-left: solid 1px #818181; border-right: solid 1px #818181;">
                        <tr style="background-color: #818181; color: White;">
                            <td style="width: 50%; padding-left: 10px">
                                <b>Voucher No: </b>&nbsp;
                                <asp:Literal ID="ltrvoucherno" runat="server" Text='<%#Eval("TransactionNumber") %>' />
                                <asp:HiddenField ID="htrans_id" runat="server" Value='<%#Eval("TransactionId") %>' />
                            </td>
                            <td style="width: 50%; text-align: right; padding-right: 10px">
                                <b>Date : </b>&nbsp;
                                <%#string.Format("{0:dd-MMM-yyyy}", Eval("TransactionDate"))%>
                                <asp:HyperLink ID="hyp_print" NavigateUrl="#" runat="server">
                                <img src="../../../Images/print.png" /></asp:HyperLink>
                                &nbsp;
                                <%--  <asp:HyperLink ID="hyperEdit" runat="server">
                                <img src="../../../Menu/images/Edit_user.png" alt="Edit This Voucher" /></asp:HyperLink>--%>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" style="padding: 0px 10px 0px 10px; width: 100%;">
                                <asp:GridView ID="gridContra" runat="server" DataKeyNames="TransactionSerial" AutoGenerateColumns="false"
                                    Style="margin: 0px;" OnRowDataBound="gridContra_RowDataBound" Width="100%" ShowFooter="true">
                                    <Columns>
                                        <asp:TemplateField HeaderText="S. No.">
                                            <ItemTemplate>
                                                <%# Container.DataItemIndex+1 %>
                                            </ItemTemplate>
                                            <ItemStyle HorizontalAlign="Center" Width="40px" />
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Dr/Cr" HeaderStyle-HorizontalAlign="Left">
                                            <ItemTemplate>
                                                <asp:Literal ID="ltrdr_cr" runat="server"></asp:Literal>
                                            </ItemTemplate>
                                            <ItemStyle Width="40px" />
                                        </asp:TemplateField>
                                        <asp:BoundField HeaderText="Particulars" DataField="particulars" FooterText="Total">
                                            <FooterStyle Font-Bold="True" HorizontalAlign="Right" />
                                            <ItemStyle Width="50%" />
                                        </asp:BoundField>
                                        <asp:TemplateField HeaderText="Debit">
                                            <ItemTemplate>
                                                <asp:Literal ID="ltrdebit" runat="server" Text='<%#Eval("Debit") %>'></asp:Literal>
                                            </ItemTemplate>
                                            <FooterTemplate>
                                                <asp:Literal ID="ltrtotdr" runat="server"></asp:Literal>
                                            </FooterTemplate>
                                            <FooterStyle Font-Bold="true" />
                                            <ItemStyle HorizontalAlign="Right" />
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Credit">
                                            <ItemTemplate>
                                                <asp:Literal ID="ltrcredit" runat="server" Text='<%#Eval("Credit") %>'></asp:Literal>
                                            </ItemTemplate>
                                            <FooterTemplate>
                                                <asp:Literal ID="ltrtotcr" runat="server"></asp:Literal>
                                            </FooterTemplate>
                                            <FooterStyle Font-Bold="true" />
                                            <ItemStyle HorizontalAlign="Right" />
                                        </asp:TemplateField>
                                    </Columns>
                                    <EmptyDataTemplate>
                                    <span style="color:Red; font-weight:bold;">Record Not Found !</span>
                                    </EmptyDataTemplate>
                                </asp:GridView>
                            </td>
                        </tr>
                        <tr>
                            <td valign="top" style="padding-left: 10px; width: 30%">
                                <asp:Literal ID="ltrcheque_name" runat="server" Text="Cheque No:  " />
                                <asp:Literal ID="ltrcheque_no" runat="server" Text='<%#Eval("ChequeNumber") %>'></asp:Literal>
                            </td>
                            <td valign="top" style="width: 70%; padding-right: 10px">
                                <asp:Literal ID="ltrnarration_name" runat="server" Text="Narration: " />
                                <asp:Literal ID="ltrnarration" runat="server" Text='<%#Eval("Narration") %>'></asp:Literal>
                            </td>
                        </tr>
                    </table>
                </ItemTemplate>
                <EditItemTemplate>
                 <span style="color:Red; font-weight:bold;">Record Not Found !</span>
                </EditItemTemplate>
            </asp:DataList>
        </asp:Panel>
        <%-- <div id="divMessage" runat="server" style="width: 95%; text-align: center; border: solid 1px #818181;
            height: 40px; vertical-align: middle;">
            <asp:Label ID="lbl_noRecord" runat="server" ForeColor="Red" ></asp:Label>
        </div>--%>
        <asp:Panel ID="pnlpaging" runat="server" Visible="true">
            <center>
                <table width="20%" style="margin-left: 5px; margin-top: 7px;">
                    <tr style="height: 4px;">
                        <td style="font-size: 12px; text-align: center; font-family: Verdana; color: #555555;
                            text-decoration: none;">
                            <asp:DataList ID="DLPaging" CellSpacing="4" runat="server" Style="text-align: center;"
                                OnItemCommand="DLPaging_ItemCommand" RepeatDirection="Horizontal" OnItemDataBound="DLPaging_ItemDataBound">
                                <ItemTemplate>
                                    <asp:LinkButton ID="LnkBtnPaging" BorderColor="#cacaca" BorderWidth="1px" BorderStyle="Solid"
                                        CssClass="pgr" CommandArgument='<%# Eval("PageIndex") %>' Text='<%# Eval("PageText") %>'
                                        Style="padding: 2px;" runat="server" CommandName="Paging">  </asp:LinkButton>
                                </ItemTemplate>
                            </asp:DataList>
                        </td>
                    </tr>
                </table>
            </center>
        </asp:Panel>
        <%-- </ContentTemplate>
        </asp:UpdatePanel>--%>
    </div>
    </form>
</body>
</html>
